<?php

declare(strict_types=1);

namespace App\Admin\Controller;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use App\Admin\Request\Public\GetListPageRequest;
use App\Admin\Request\Admin\SaveAddRequest;
use App\Common\Demand\Server\Admin;
#[AutoController(prefix:"admin/admin")]
class AdminController extends AbstractController
{
    #[Inject]
    protected Admin $service;
    //获取管理员列表
    public function getListPage(GetListPageRequest $request)
    {
        $validated = $request->validated();
        return $this->utils->lxSuccessReturn($this->translatorInterface->trans('admin.getListSuccess'), $this->service->getListPage($validated,['admin_id','account','name','tel','create_time']));
    }
    //添加管理员
    public function saveAdd(SaveAddRequest $request)
    {
        $validated = $request->validated();
        return $this->utils->lxSuccessReturn($this->translatorInterface->trans('admin.getListSuccess'), [$this->service->saveAdd($validated)]);
    }
}
